package outerclass.sample_demo;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 38917
 * Date: 2025/5/11
 * Time: 14:10
 */

public class Test {
    public static SampleOuterClass sample;
    public static void main2(String[] args) {
        //未创建外部类对象而直接创建内部类对象会抛出NullPointerException异常
        SampleOuterClass.SampleInnerClass sampleInnerClass =
                sample.new SampleInnerClass("inner");
    }
    public static void main(String[] args) {
        SampleOuterClass sampleOuterClass = new SampleOuterClass("outer1");
        SampleOuterClass.SampleInnerClass sampleInnerClass =
                sampleOuterClass.new SampleInnerClass("inner");
        sampleInnerClass.inner2();
    }
}
